using System;
using System.Collections;

namespace UnityHotFix
{
    /// <summary>
    /// 资源对象
    /// </summary>
    public class ResourceObject : IEnumerator
    {
        // 全路径名
        public string name;
        // 优先级:0、1、2，数字越小优先级越高
        public int priority;
        // 资源类型
        public ResourceType type;
        // 资源状态
        public ResourceState state;
        // 下载或加载进度
        public float progress;
        // 原始字节数据
        public byte[] bytes;
        // 解析完成的对象
        public object completeObject;
        // 完成回调
        public Action<ResourceObject> completeCallback;

        object IEnumerator.Current => null;
        bool IEnumerator.MoveNext() { return !(state == ResourceState.Success || state == ResourceState.Error); }
        void IEnumerator.Reset() { }
    }
}